<template>
	<view class="jec-input">
		<text class="jec-input__label" v-if="label">{{ label }}</text>
		<view class="jec-input-content">
			<text class="iconfont" :style="{ color: iconColor, fontSize: iconSize }" v-if="icon">{{ icon }}</text>
			<input class="jec-input__input" v-model="value" :type="type" :password="password" />
		</view>
	</view>
</template>

<script setup>
	const value = defineModel()
	defineProps({
		label: {
			type: String,
			default: ''
		},
		icon: {
			type: String,
			default: ''
		},
		iconColor: {
			type: String,
			default: '#303133'
		},
		iconSize: {
			type: String,
			default: '32rpx'
		},
		type: {
			type: String,
			default: 'text'
		},
		password: {
			type: Boolean,
			default: false
		}
	})
</script>

<style lang="scss">
.jec-input {
	position: relative;
	padding-top: 22rpx;
	.jec-input__label {
		position: absolute;
		top: 0;
		left: 20rpx;
		display: inline-block;
		min-width: 150rpx;
		background-color: #fff;
		font-size: 28rpx;
		line-height: 44rpx;
		text-align: center;
		z-index: 1;
		color: #4F5D74;
	}
	.jec-input-content {
		display: flex;
		flex-direction: row;
		align-items: center;
		border-radius: 20rpx;
		height: 96rpx;
		padding: 0 60rpx;
		border: 1px solid $uni-border-color;
		.iconfont {
			margin-right: 28rpx;
		}
		.jec-input__input {
			flex: 1;
			min-width: 0;
			height: 44rpx;
		}
	}
}
</style>